🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / node / src / commonMain / kotlin / org / meshtastic / feature / node / model / TimeFrame.kt
Displaying Raw • Download
feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/model/TimeFrame.kt 1390a3cd4f7bc55a37433d1d868e65c01678eb31 (1390a3cd) Text, 2.12 KB
T8b949e/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.node.model
Tff7b72import T7ee787org.jetbrains.compose.resources.StringResource
Tff7b72import T7ee787org.meshtastic.core.common.util.nowSeconds
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.all_time
Tff7b72import T7ee787org.meshtastic.core.resources.one_hour_short
Tff7b72import T7ee787org.meshtastic.core.resources.one_month
Tff7b72import T7ee787org.meshtastic.core.resources.one_week
Tff7b72import T7ee787org.meshtastic.core.resources.twenty_four_hours
Tff7b72import T7ee787org.meshtastic.core.resources.two_weeks
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffMagicNumberTa5d6ff"Tb4b4b4)
Tff7b72enum Tff7b72class T56d364TimeFrameTb4b4b4(Tff7b72val Te6edf3strResTb4b4b4: Te6edf3StringResourceTb4b4b4, Tff7b72val Te6edf3secondsTb4b4b4: Tffa657LongTb4b4b4) Tb4b4b4{
Te6edf3ONE_HOURTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3one_hour_shortTb4b4b4, T79c0ff3T79c0ff6T79c0ff0T79c0ff0Tb4b4b4)Tb4b4b4,
Te6edf3TWENTY_FOUR_HOURSTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3twenty_four_hoursTb4b4b4, T79c0ff8T79c0ff6T79c0ff4T79c0ff0T79c0ff0Tb4b4b4)Tb4b4b4,
Te6edf3SEVEN_DAYSTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3one_weekTb4b4b4, T79c0ff6T79c0ff0T79c0ff4T79c0ff8T79c0ff0T79c0ff0Tb4b4b4)Tb4b4b4,
Te6edf3TWO_WEEKSTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3two_weeksTb4b4b4, T79c0ff1T79c0ff2T79c0ff0T79c0ff9T79c0ff6T79c0ff0T79c0ff0Tb4b4b4)Tb4b4b4,
Te6edf3ONE_MONTHTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3one_monthTb4b4b4, T79c0ff2T79c0ff5T79c0ff9T79c0ff2T79c0ff0T79c0ff0T79c0ff0Tb4b4b4)Tb4b4b4,
Te6edf3ALL_TIMETb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3all_timeTb4b4b4, T79c0ff0Tb4b4b4)Tb4b4b4,
Tb4b4b4;
Tff7b72fun Td2a8fftimeThresholdTb4b4b4(Te6edf3nowTb4b4b4: Tffa657Long Tff7b72= Te6edf3nowSecondsTb4b4b4)Tb4b4b4: Tffa657Long Tb4b4b4{
Tff7b72if Tb4b4b4(Tff7b72this Tff7b72=Tff7b72= Te6edf3ALL_TIMETb4b4b4) Tff7b72return T79c0ff0
Tff7b72return Te6edf3now Tff7b72- Te6edf3seconds
Tb4b4b4}
T8b949e/**
* Checks if this time frame is relevant given the oldest available data point. We show the option if the data
* extends at least into this timeframe.
*/
Tff7b72fun Td2a8ffisAvailableTb4b4b4(Te6edf3oldestTimestampSecondsTb4b4b4: Tffa657LongTb4b4b4, Te6edf3nowTb4b4b4: Tffa657Long Tff7b72= Te6edf3nowSecondsTb4b4b4)Tb4b4b4: Tffa657Boolean Tb4b4b4{
Tff7b72if Tb4b4b4(Tff7b72this Tff7b72=Tff7b72= Te6edf3ALL_TIME Tff7b72|Tff7b72| Tff7b72this Tff7b72=Tff7b72= Te6edf3ONE_HOURTb4b4b4) Tff7b72return Tff7b72true
Tff7b72val Te6edf3rangeSeconds Tff7b72= Te6edf3now Tff7b72- Te6edf3oldestTimestampSeconds
Tff7b72return Te6edf3rangeSeconds Tff7b72>Tff7b72= Te6edf3seconds
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s